-- @owner: lihongji
-- @date: 2022/07/26
-- @testpoint: regr_avgx

--step1：打开ustore设置开关；expect：成功
set extra_float_digits to 0;
set enable_default_ustore_table = on;
--step2:建序列;expect:成功
drop sequence if exists pop_samp_variance_seq_avgx;
create sequence pop_samp_variance_seq_avgx increment by 1 start with 10;

--step3:建表并插入数据;expect:成功
drop table if exists table_0001 cascade;
create table table_0001(
  col_1 integer,
  col_2 number(19,0),
  col_3 number(10,6)
) with (storage_type=ustore);
begin
 for i in 1..50 loop
  insert into table_0001 values(
  i,
  pop_samp_variance_seq_avgx.nextval,
  i+445.255
  );
 end loop;
end;
/

--step4:查询;expect:成功
select regr_avgx(col_2,col_2) from table_0001 order by 1;
select regr_avgx(col_3,col_3) from table_0001 order by 1;

--step5:清理环境;expect:成功
drop sequence if exists pop_samp_variance_seq_avgx;
drop table if exists table_0001 cascade;
--step6：关闭ustore设置开关；expect：成功
set enable_default_ustore_table = off;